/**
 * @author:linjiye
 * @date: 2024/01/13
 * @desc: 自定义钩子：进行异步本地化存储数据
 **/
import AsyncStorage from "@react-native-async-storage/async-storage";

const useSetStorage = async (key:string, value:any) => {
    try {
        await AsyncStorage.setItem(key, JSON.stringify(value));
        // console.log('数据存储成功');
        return {
            message: '数据存储成功',
            code: 200,
        }
    } catch (e) {
        console.error('存储数据时出错:', e);
    }
};

export default useSetStorage